bitkeeper revision 1.1108.1.6 (40fe62673yjDDWr_lJLCZV970Wralw)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Wed, 21 Jul 2004 12:32:39 +0000 (12:32 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Wed, 21 Jul 2004 12:32:39 +0000 (12:32 +0000)
Fix problem with POST - need Content-Length header.

tools/python/xen/xend/XendClient.py

index e07add6b06348730871bb5fe66edcbeb0f450fb4..b5ebf557f16fbedd9caeb438a9677b17738b4d04 100644 (file)
@@ -236,6 +236,8 @@ class AsynchXendClient(http.HTTPClient):
         self.sendHeader('Host', url.location())
         for (k, v) in request.headers.items():
             self.sendHeader(k, v)
+        if request.data:
+            self.sendHeader('Content-Length', len(request.data))
         self.endHeaders()
         if request.data:
             self.transport.write(request.data)
@@ -517,22 +519,6 @@ class Xend:
         return self.xendGet(self.dmesgurl())
     
 
-def synchmain(srv, argv):
-    xend = Xend(srv=srv)
-    if len(argv) > 1:
-        fn = argv[0]
-    else:
-        fn = 'xend'
-    if not fn.startswith('xend'):
-        fn = 'xend_' + fn
-    args = argv[1:]
-    try:
-        val = getattr(xend, fn)(*args)
-        PrettyPrint.prettyprint(val)
-    except XendError, err:
-        print 'ERROR:', err
-        sys.exit(1)
-
 def xendmain(srv, asynch, fn, args):
     if asynch:
         client = AsynchXendClientProtocol()
@@ -586,7 +572,7 @@ def main(argv):
             srv = v
         elif k in ['-a', '--asynch']:
             asynch = 1
-        elif k in ['-d', '--DEBUG']:
+        elif k in ['-d', '--debug']:
             DEBUG = 1
     if len(args):
         fn = args[0]